package ru.poomsae.isap.Offline.Hapkido

import android.os.Bundle
import android.view.Menu
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import ru.poomsae.isap.R


class HapkiFreestyleOffline : AppCompatActivity()  {

    lateinit var myTextView: TextView
    lateinit var myLinearLayout: LinearLayout
    lateinit var myRelativeLayout: RelativeLayout
    lateinit var mySudTextView: TextView
    lateinit var myPoomsaeTextView: TextView

    var hie = 0
    var num = 0
    var ang = 0
    var spa = 0
    var acr = 0
    var bas = 0

    var accy = 0.0

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.freestyle_hapkido)

        myTextView = findViewById(R.id.idvistFreeText) as TextView
        myLinearLayout = findViewById(R.id.progressBarFree) as LinearLayout
        myRelativeLayout= findViewById(R.id.freestyle) as RelativeLayout
        mySudTextView = findViewById(R.id.sudNumFreeTV) as TextView
        myPoomsaeTextView = findViewById(R.id.poomsaeFreeTV) as TextView

//        when (ParametrsISAP.hapki) {
//            1 -> {
//                textHapkiView1.text = (getString(R.string.udary_zach))
//                textHapkiView2.text = (getString(R.string.udar_nogam_pr))
//                textHapkiView3.text = (getString(R.string.udar_vrash))
//                textHapkiView4.text = (getString(R.string.navik))
//                textHapkiView5.text = (getString(R.string.peredvijenie))
//                textHapkiView6.text = (getString(R.string.hapki_acro))
//            }
//            3 -> {
//                textHapkiView1.text = (getString(R.string.brosok_teh))
//                textHapkiView2.text = (getString(R.string.razbiv_predm))
//                textHapkiView3.text = (getString(R.string.slojny_udar_nog))
//                textHapkiView4.text = (getString(R.string.navik_oruj))
//                textHapkiView5.text = (getString(R.string.dinamik_pered))
//                textHapkiView6.text = (getString(R.string.hapki_acro))
//            }
//        }
//
//        height.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                hie = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                heigFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        kick.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                num = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                numkickFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        angle.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                ang = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                angleFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        sparing.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                spa = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                sparFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        acrobatic.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                acr = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                acrFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        basic.setOnCheckedChangeListener(
//            RadioGroup.OnCheckedChangeListener { group, checkedId ->
//                val radio: RadioButton = findViewById(checkedId)
//                bas = ((radio.text as String).toDouble() * (10).toDouble()).toInt()
//                accy = (hie + num + ang + spa + acr + bas).toDouble()/(10).toDouble()
//                basFree.setText(radio.text as String)
//                accyrFree.setText(String.format("%.1f",accy))
//            })
//
//        btnPresentationFree.setOnClickListener {
//            val intent = Intent (this, HapkiPresentation::class.java)
//            intent.putExtra("accuracyDoubleFree", accy)
//            startActivity(intent)
//        }


    }

    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.menu_off, menu)
        return true
    }

//    override fun onOptionsItemSelected(item: MenuItem?): Boolean {
//        when(item?.itemId) {
//
//            R.id.menu_offline -> {
//                val intent = Intent (this, MenuActivity::class.java)
//                startActivity(intent)
//            }
//
//        }
//
//        return true
//    }

}